<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>加法</title>
    <script>
        function add(){
            let a = document.getElementById("a").value;
            let b = document.getElementById("b").value;
            a = parseInt(a);
            b = parseInt(b);
            let sum = a + b;
            document.getElementById("c").innerText = sum;
            document.getElementById("d").value = sum;
        }
    </script>
</head>
<body>
    <input id="a"/> + <input id="b"/> = <span id="c">11</span><br/>
    <input id="d" readonly/>

    <button onclick="add()">计算</button>
</body>
</html>